import request from '@/utils/request'

// 生成视频
export function generateVideos(data) {
    return request({
        url: '/video/video/generate/batch',
        method: 'post',
        data
    })
}

// 生成视频-多数字人模式
export function generateAiVideos(data) {
    return request({
        url: '/video/video/generate/batch/ai',
        method: 'post',
        data
    })
}

// 获取任务
export function getTaskList(params) {
    return request({
        url: '/video/video/task/list',
        method: 'get',
        params: params
    })
}

// 获取任务状态
export function getTaskStatus(taskIds) {
    return request({
        url: '/video/video/task/status',
        method: 'get',
        params: { taskIds: taskIds.join(',') }
    })
}

// 获取视频配置
export function getVideoConfigs() {
    return request({
        url: '/video/video/config/list',
        method: 'get'
    })
}

// 删除任务
export function deleteTask(taskId) {
    return request({
        url: `/video/video/task/${taskId}`,
        method: 'delete'
    })
}

// 重试任务
export function retryTask(taskId) {
    return request({
        url: `/video/video/task/retry/${taskId}`,
        method: 'post'
    })
}

// 批量重试任务
export function batchRetryTask(taskIds) {
    return request({
        url: `/video/video/task/batch-retry`,
        method: 'post',
        data: taskIds
    })
}

// 批量删除任务
export function batchDeleteTasks(taskIds) {
    return request({
        url: '/video/video/task/batch',
        method: 'delete',
        data: { ids: taskIds }
    })
}

// 批量下载视频
export function downloadVideos(taskIds) {
    return request({
        url: '/video/video/task/download',
        method: 'get',
        params: { taskIds: taskIds.join(',') },
        responseType: 'blob',
        headers: {
            'Accept': 'application/zip'
        }
    })
}